<%@ page import="com.example.dao.LoginDao" %>
<%@ page import="com.example.pojo.Coach" %>
<%@ page import="com.example.pojo.Member" %>
<%@ page import="com.example.dao.MemberDao" %>
<%@ page import="java.util.List" %>
<%@ page import="com.example.dao.CourseDao" %>
<%@ page import="com.example.pojo.Course" %>
<%@ page import="com.example.dao.EquipDao" %>
<%@ page import="com.example.pojo.Equipment" %><%--
  Created by IntelliJ IDEA.
  User: LSK
  Date: 2020/4/19
  Time: 22:39
  To change this template use File | Settings | File Templates.
--%>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/css/font-awesome.css" rel="stylesheet">
<link href="bootstrap/css/animate.css" rel="stylesheet">
<link href="bootstrap/css/style.css" rel="stylesheet">
<link href="bootstrap/css/plugins/iCheck/custom.css" rel="stylesheet">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>教练详情页面</title>
</head>
<body>
<div class="container">

    <%
        Coach coach = new LoginDao().coachLogin(
                request.getParameter("user"),
                request.getParameter("pass")
        );
        out.print("<h1> 欢迎您:"+coach.getName()+"教练  "+
        "  ("+coach.getPhone()+" )"+
        " </h1>");

    %>
        <div class="container">
            <table class="table table-bordered">
                <caption>
                    <h2>会员资料浏览</h2>
                </caption>
                <thead>
                <tr>
                    <th>编号</th>
                    <th>姓名</th>
                    <th>年龄</th>
                    <th>性别</th>
                    <th>手机号码</th>
                    <th>会员等级</th>
                </tr>
                </thead>
                <tbody>
                <%
                    List<Member> members = new MemberDao().memberList();
                    for (Member member : members) {
                        out.print("<tr>");
                        out.print("<td>" + member.getId() + "</td>");
                        out.print("<td>" + member.getName() + "</td>");
                        out.print("<td>" + member.getAge() + "</td>");
                        out.print("<td>" + member.getSex() + "</td>");
                        out.print("<td>" + member.getPhone() + "</td>");
                        out.print("<td>" + member.getLevel() + "</td>");
                        out.print("</tr>");
                    }
                %>
                </tbody>
            </table>

    <table class="table table-hover table-bordered">
        <caption>
            <h2>课程信息浏览</h2>
        </caption>
        <thead>
        <tr>
            <th>课程编号</th>
            <th>课程日期</th>
            <th>课程名称</th>
            <th>课程详细内容</th>
            <th>教练</th>
        </tr>
        </thead>
        <tbody>
        <%
            CourseDao dao2=new CourseDao();
            for(Course course:dao2.courseList())
            {
                out.print("<tr>");
                out.print("<td>"+course.getId()+"</td>");
                out.print("<td>"+course.getDate()+"</td>");
                out.print("<td>"+course.getCourse_name()+"</td>");
                out.print("<td>"+course.getCourse_content()+"</td>");
                out.print("<td>"+course.getTeacher()+"</td>");
                out.print("</tr>");
            }
        %>
        </tbody>
    </table>


    <table class="table table-hover table-bordered">
        <caption>
            <h2>健身器材信息浏览</h2>
        </caption>
        <thead>
        <tr>
            <th>器材编号</th>
            <th>器材名称</th>
            <th>购置日期</th>
            <th>总数</th>
            <th>当前空闲总数</th>
        </tr>
        </thead>
        <tbody>
        <%
            EquipDao dao3=new EquipDao();
            for(Equipment equipment:dao3.selectEquipments(true))
            {
                out.print("<tr>");
                out.print("<td>"+equipment.getId()+"</td>");
                out.print("<td>"+equipment.getName()+"</td>");
                out.print("<td>"+equipment.getDate()+"</td>");
                out.print("<td>"+equipment.getCount()+"</td>");
                out.print("<td>"+equipment.getFree_count()+"</td>");
                out.print("</tr>");
            }
        %>
        </tbody>
    </table>
</div>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="bootstrap/js/jquery.min.js"></script>
<script src="bootstrap/js/plugins/iCheck/icheck.min.js"></script>
</body>
</html>
